﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:p="clr-namespace:Lithnet.Acma.Presentation"
                    xmlns:a="clr-namespace:Lithnet.Acma;assembly=Lithnet.Acma"
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:fim="clr-namespace:Microsoft.MetadirectoryServices;assembly=Microsoft.MetadirectoryServicesEx"
                    xmlns:core="clr-namespace:Lithnet.Common.Presentation;assembly=Lithnet.Common.Presentation">

    <DataTemplate  DataType="{x:Type p:AcmaSequenceViewModel}">
        <StackPanel>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Label Content="Name"
                       Grid.Row="0"
                       Grid.Column="0" />
                <TextBox Text="{Binding Name, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}"
                         Grid.Row="0"
                         Margin="2"
                         Grid.Column="1"
                         IsReadOnly="{Binding IsReadOnly, Mode=OneWay}" >
                    
                </TextBox>

                <Label Content="Start value"
                       Grid.Row="1"
                       Grid.Column="0" />
                <TextBox Text="{Binding StartValue, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}"
                         Grid.Row="1"
                         Margin="2"
                         Grid.Column="1"
                         IsReadOnly="{Binding IsReadOnly, Mode=OneWay}">
                    <i:Interaction.Behaviors>
                        <core:TextBoxInputRegExBehaviour RegularExpression="^\-??\d+$"
                                                         MaxLength="0"
                                                         EmptyValue="0" />
                    </i:Interaction.Behaviors>
                </TextBox>

                <Label Content="Increment by"
                       Grid.Row="2"
                       Grid.Column="0" />
                <TextBox Text="{Binding Increment, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}"
                         Grid.Row="2"
                         Margin="2"
                         Grid.Column="1"
                         IsReadOnly="{Binding IsReadOnly, Mode=OneWay}">
                    <i:Interaction.Behaviors>
                        <core:TextBoxInputRegExBehaviour RegularExpression="^\-??\d+$"
                                                         MaxLength="0"
                                                         EmptyValue="0" />
                    </i:Interaction.Behaviors>
                </TextBox>

                <Label Content="Min value"
                       Grid.Row="3"
                       Grid.Column="0" />
                <TextBox Text="{Binding MinValue, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}"
                         Grid.Row="3"
                         Margin="2"
                         Grid.Column="1"
                         IsReadOnly="{Binding IsReadOnly, Mode=OneWay}">
                    <i:Interaction.Behaviors>
                        <core:TextBoxInputRegExBehaviour RegularExpression="^\-??\d+$"
                                                         MaxLength="0"
                                                         EmptyValue="0" />
                    </i:Interaction.Behaviors>
                </TextBox>

                <Label Content="Max value"
                       Grid.Row="4"
                       Grid.Column="0" />
                <TextBox Text="{Binding MaxValue, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}"
                         Grid.Row="4"
                         Margin="2"
                         Grid.Column="1"
                         IsReadOnly="{Binding IsReadOnly, Mode=OneWay}">
                    <i:Interaction.Behaviors>
                        <core:TextBoxInputRegExBehaviour RegularExpression="^\-??\d+$"
                                                         MaxLength="0"
                                                         EmptyValue="0" />
                    </i:Interaction.Behaviors>
                </TextBox>

                <Label Content="Cycle"
                       Grid.Row="5"
                       Grid.Column="0" />
                <CheckBox IsChecked="{Binding IsCycleEnabled, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}"
                          Grid.Row="5"
                          Margin="2"
                          Grid.Column="1"
                          VerticalAlignment="Center"
                          IsEnabled="{Binding IsEditing, Mode=OneWay}" />

                <Label Content="Current value"
                       Grid.Row="6"
                       Grid.Column="0" />
                <Label Content="{Binding CurrentValue, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=OneWay}"
                       Grid.Row="6"
                       Margin="2"
                       Grid.Column="1" />

                <StackPanel Orientation="Horizontal"
                            Grid.Row="6"
                            Grid.Column="1"
                            HorizontalAlignment="Right">
                    <Button Content="{Binding EditButtonText, Mode=OneWay}"
                            Command="{Binding Commands.Edit}"
                            MinWidth="50"
                            MinHeight="27"
                            Margin="0 10 5 0" />

                    <Button Content="Cancel"
                            Command="{Binding Commands.Cancel}"
                            IsEnabled="{Binding IsEditing, Mode=OneWay}"
                            MinWidth="50"
                            MinHeight="27"
                            Margin="0 10 0 0" />
                </StackPanel>
            </Grid>
        </StackPanel>
    </DataTemplate>

</ResourceDictionary>